package io.jpress.web;


import io.jpress.permission.PermissionGroupBean;
import io.jpress.permission.PermissionGroupBuilder;
import io.jpress.permission.PermissionTypes;

import java.util.ArrayList;
import java.util.List;

/**
 * 自定义权限组
 *
 * @author michael yang (fuhai999@gmail.com)
 */
public class AdminPermissionGroups implements PermissionGroupBuilder {

    public static final String DASHBOARD = "core:dashboard";
    public static final String ATTACHMENT = "core:attachment";
    public static final String USER = "core:user";
    public static final String WECHAT = "core:wechat";
    public static final String TEMPLATE = "core:template";
    public static final String FLOW = "core:flow";
    public static final String ADDON = "core:addon";
    public static final String SYSTEM = "core:system";
    public static final String STATISTICS = "core:statistics";

    public static final String DEFAULT_SENSITIVE = "core:sensitive";


    /**
     * JPress 系统默认权限
     */
    private static List<PermissionGroupBean> corePermissionGroups = new ArrayList<>();

    static {
        corePermissionGroups.add(new PermissionGroupBean(DASHBOARD, "面板", null, PermissionTypes.ACTION, 100));
        corePermissionGroups.add(new PermissionGroupBean(ATTACHMENT, "附件", null, PermissionTypes.ACTION, 200));
        corePermissionGroups.add(new PermissionGroupBean(FLOW, "审核", null, PermissionTypes.ACTION, 220));
        corePermissionGroups.add(new PermissionGroupBean(USER, "用户", null, PermissionTypes.ACTION, 500));
        corePermissionGroups.add(new PermissionGroupBean(WECHAT, "微信", null, PermissionTypes.ACTION, 600));
        corePermissionGroups.add(new PermissionGroupBean(TEMPLATE, "模板", null, PermissionTypes.ACTION, 700));
        corePermissionGroups.add(new PermissionGroupBean(ADDON, "插件", null, PermissionTypes.ACTION, 800));
        corePermissionGroups.add(new PermissionGroupBean(SYSTEM, "系统", null, PermissionTypes.ACTION, 900));
        corePermissionGroups.add(new PermissionGroupBean(STATISTICS, "统计", null, PermissionTypes.ACTION, 1000));


        corePermissionGroups.add(new PermissionGroupBean(DEFAULT_SENSITIVE, "默认", null, PermissionTypes.SENSITIVE, 111));
    }


    @Override
    public List<PermissionGroupBean> buildPermissionGroups() {
        return corePermissionGroups;
    }
}
